import numpy as np
from scipy.io import wavfile
from scipy.signal import spectrogram


fs, data = wavfile.read('example.wav')

w_l = fs*1

fft_result = np.fft.fft(data[:w_l])
freq = np.fft.fftfreq(len(fft_result), 1/fs)
#print(fs)
#print(freq)

#exit()


import matplotlib.pyplot as plt

plt.figure(figsize=(12, 6))
plt.plot(freq, np.abs(fft_result))
plt.xlabel('Frequency (Hz)')
plt.ylabel('Amplitude')
plt.title('FFT of Audio Signal')
plt.xlim(0, fs / 2)
plt.grid()
plt.show()